package com.hmall.pojo;

import lombok.Data;
import lombok.NoArgsConstructor;
import com.hmall.item.pojo.Item;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 长夜漫漫，代码相伴
 * @date 2022/6/20
 */

@Data
@NoArgsConstructor
public class ItemDto {

    private Long id;//商品id
    private String name;//商品名称
    private Long price;//价格（分）
    private String image;//商品图片
    private String category;//分类名称
    private String brand;//品牌名称
    private Integer sold;//销量
    private Integer commentCount;//评论数
    private List<String> suggestion;

    public ItemDto(Item item) {
        this.id = item.getId();
        this.name = item.getName();
        this.price = item.getPrice();
        this.image = item.getImage();
        this.category = item.getCategory();
        this.brand = item.getBrand();
        this.sold = item.getSold();
        this.commentCount = item.getCommentCount();

        this.suggestion = new ArrayList<>();
        this.suggestion.add(brand);
        this.suggestion.add(category);
    }

}
